package com.wowoai.dialog.entity;

import com.wowoai.chatai.enums.ImageStatusEnum;
import com.wowoai.common.basemodule.BaseEntity;
import com.wowoai.dialog.service.enums.DialogHistoryTypeEnum;
import com.wowoai.user.enums.YesOrNoEnum;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

@Getter
@Setter
@Table(name = "dialog_history")
@Entity
public class DialogHistoryEntity extends BaseEntity {

    @Column(name = "phone_number")
    private String phoneNumber;

    /**
     *
     *问题 -- （魔咒）
     */
    @Column(name = "problem")
    private String problem;

    /**
     * 答案 - -（taskId）
     */
    @Column(name = "answer")
    private String answer;
    /**
     * 1-ai对话，2-ai绘画
     */
    @Column(name = "type")
    private Short type;

    @Column(name = "image_state")
    private Short imageState;

    public static DialogHistoryEntity create(Long id, Long userId, String userName, String phoneNumber, String problem, String answer, DialogHistoryTypeEnum typeEnum){
        DialogHistoryEntity dialogHistoryEntity = new DialogHistoryEntity();
        dialogHistoryEntity.setId(id);
        dialogHistoryEntity.setCreatorId(userId);
        dialogHistoryEntity.setCreatorName(userName);
        dialogHistoryEntity.setCreateTime(System.currentTimeMillis());
        dialogHistoryEntity.setPhoneNumber(phoneNumber);
        dialogHistoryEntity.setDeleted(false);
        dialogHistoryEntity.setProblem(problem);
        dialogHistoryEntity.setAnswer(answer);
        dialogHistoryEntity.setType(typeEnum.getCode());
        return dialogHistoryEntity;
    }
}
